# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName : zsj.py
# @Time     : 2024/4/21 22:16
# @Author   : Robot-Zsj
"""
description:

i:
5
1 2
2 3
3 4
4 5

o:
3
"""
import sys

n = int(input())
relations = [list(map(int, input().split())) for i in range(n - 1)]


class UnionFindSet:
    def __init__(self, n):
        self.fa = [i for i in range(n)]

    def find(self, x):
        if x != self.fa[x]:
            self.fa[x] = self.find(self.fa[x])
        return self.fa[x]

    def union(self, x, y):
        x_fa = self.find(x)
        y_fa = self.find(y)
        if x_fa != y_fa:
            self.fa[y_fa] = x_fa


def getResult():
    minDp = sys.maxsize

    city = []

    for i in range(1, n + 1):
        ufs = UnionFindSet(n + 1)

        for x, y in relations:
            if x == i or y == i:
                continue
            ufs.union(x, y)

        cnts = [0] * (n + 1)
        for j in range(1, n + 1):
            fa = ufs.find(j)
            cnts[fa] += 1

        dp = max(cnts)

        if dp < minDp:
            minDp = dp
            city = [i]
        elif dp == minDp:
            city.append(i)

    city.sort()
    return " ".join(map(str, city))


print(getResult())
